const app=getApp()
Page({
    data:{
        fei:0,
        feiban:0,
        condition:false,
        statusBarHeight:app.globalData.statusBarHeight//顶部标题栏高度
    },
    home(){
      wx.redirectTo({
        url: '/pages/work1/index',
      })
    },
    switchchange(e){
        console.log(e)
        let condition=e.detail.value
        let f=Number(this.data.fei)
        if(condition){
            this.setData({
                condition,fei:(f*2).toFixed(2),feiban:f.toFixed(2)
            })
        }else{
            this.setData({
            condition,fei:(f/2).toFixed(2),feiban:(f/4).toFixed(2)
        })
        } 
    },
    formsubmit(e){
        console.log(e)
        let bd=Number(e.detail.value.property)
        let fei=0
        if(bd<=10000){
            fei = 50 
          }else if(bd>10000&&bd<=100000){
            fei = (50 + (bd-10000)*0.025)
          }else if(bd>100000&&bd<=200000){
            fei = (2300 + (bd-100000)*0.02)
          }else if(bd>200000&&bd<=500000){
            fei = (4300 + (bd-200000)*0.015)
          }else if(bd>500000&&bd<=1000000){
            fei = (8800 + (bd-500000) * 0.01)
          }else if(bd>1000000&&bd<=2000000){
            fei = (13800 + (bd-1000000) * 0.009)
          }else if(bd>2000000&&bd<=5000000){
            fei = (22800 + (bd-2000000) * 0.008)
          }else if(bd>5000000&&bd<=10000000){
            fei = (46800 + (bd-5000000) * 0.007)
          }else if(bd>10000000&&bd<=20000000){
            fei = (81800 + (bd-10000000) * 0.006)                                           
          }else if(bd>20000000){
            fei = (141800 + (bd-20000000) * 0.005)
          }      
        if(this.data.condition){
            fei*=2
        }
        let feiban=fei/2
        fei=fei.toFixed(2)
        feiban=feiban.toFixed(2)
        this.setData({
            fei,feiban
        })
    }
})
